//
//  PersonGoOutDetailModel.m
//  MobileOffice
//
//  Created by jjkj on 16/12/15.
//  Copyright © 2016年 liaoningjujin. All rights reserved.
//

#import "PersonGoOutDetailModel.h"

@implementation PersonGoOutDetailModel
- (instancetype)initWithResponse:(id)responseObject{
    if (self=[super init]) {
        if ([responseObject[@"code"] isKindOfClass:[NSNumber class]]) {
            NSNumber *num =responseObject[@"code"] ;
            NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
            
            NSString* str = [numberFormatter stringFromNumber:num];
            
            self.code=str?str:@"";
        }else{
            self.code=responseObject[@"code"]?responseObject[@"code"]:@"";
        }
        
        self.msg=responseObject[@"msg"]?responseObject[@"msg"]:@"";
        
        NSDictionary *dataDict=responseObject[@"retContent"];
        NSArray *list=dataDict[@"locationList"];
        _dataArr=[NSMutableArray new];
        for (NSDictionary *dict in list) {
            PersonGoOutDetailModel *model=[PersonGoOutDetailModel new];
            [model setValuesForKeysWithDictionary:dict];
            [_dataArr addObject:model];
        }
        [self setValuesForKeysWithDictionary:dataDict];
    }
    
    return self;
}


- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:self.picPath forKey:KEY_PATH];
    [aCoder encodeObject:self.TOffId forKey:KEY_ID];
    [aCoder encodeObject:self.OBAddress forKey:KEY_ADDRESS];
    [aCoder encodeObject:self.locationTime forKey:KEY_TIME];
    /*
     #define KEY_STARTDATE        @"startDate"
     #define KEY_PARTIAL          @"partialData"
     #define KEY_LOADFILESIZE     @"loadedFileSize"
     #define KEY_TOTALSIZE        @"fileTotalSize"
     #define KEY_ISDOWNLOAD       @"isDownload"
     
     */
    [aCoder encodeObject:self.latitude forKey:KEY_LATITUDE];
    [aCoder encodeObject:self.longitude forKey:KEY_LONGITUDE];
    
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    if (self = [super init]) {
        self.picPath = [aDecoder decodeObjectForKey:KEY_PATH];
        self.TOffId = [aDecoder decodeObjectForKey:KEY_ID];
        self.OBAddress = [aDecoder decodeObjectForKey:KEY_ADDRESS];
        self.locationTime = [aDecoder decodeObjectForKey:KEY_TIME];
        self.latitude = [aDecoder decodeObjectForKey:KEY_LATITUDE];
        
        self.longitude = [aDecoder decodeObjectForKey:KEY_LONGITUDE];
        
    }
    return self;
}

@end
